PHP: form input field names containing square brackets like field[index]

Posted by gidireich on Stack Overflow See other posts from Stack Overflow or by gidireich
Published on 2010-12-28T03:39:18Z Indexed on 2010/12/28 3:53 UTC
Read the original article Hit count: 190

Filed under:
|

Hi,

I've seen lot of code that handle forms, which creates input fields with names containing square brackets.

I understand that this is being somehow converted to PHP arrays when a PHP script examines the $_POST variable.

My questions about this:

  • What is the mechanism behind? At which point this names that merely contain brackets are converted to arrays? Is this a feature of the HTPP protocol? Of web servers? Of the PHP language?

  • Continuing the previous question, is this a commonly used hack or a normal programming tool?

  • What are (all) the rules of using brackets in input field names?

  • Can multidimensional arrays be created this way?

Thanks,

Gidi

© Stack Overflow or respective owner

Related posts about php

Related posts about forms